package com.example.demo.demos.web.handler;

import com.example.demo.demos.web.exception.BaseException;
import com.example.demo.demos.web.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler
    public Result<String> exceptionHandler(BaseException ex){
        return Result.error(ex.getMessage());
    }

}
